const SPRITE_TYPE = {
  hero: 'hero',
  enemy: 'enemy',
};

const Sprite = (name) => {
  return {
    name,
    status: {
      hp: 100,
      mp: 100,
      atk: 50,
      def: 50,
      speed: 100
    },
    nengLi: {
      hp: 100,
      mp: 100,
      atk: 50,
      def: 50,
      speed: 100
    },
    init(name = '名称') {
      this.name = name;
    },
    setNengLi({hp, mp, atk, def, speed}) {
      this.nengLi = {hp, mp, atk, def, speed};
    }
  }
};

const Hero = (name) => {
  return {
    ...Sprite(name),
    age: 10,
    stage: 0,
    type: SPRITE_TYPE.hero,
    lingGen: {
      jin: 100,
      mu: 0,
      shui: 0,
      huo: 0,
      tu: 0,
    },
    shuXing: {
      genGu: 0,
      zhenQi: 0,
      wuShu: 0,
      lingLi: 0,
      lingQiao: 0,
      jiYuan: 0,
    },
    gongFa: {},
    jiNeng: {
      zhuDong: {},
      beiDong: {}
    },
    backpack: {
      chongWu: [],
      jiNeng: []
    },
  }
};

const Enemy = (name) => {
  return {
    ...Sprite(name),
    type: SPRITE_TYPE.enemy,
    prefix: '',
  }
};

export default {
  Sprite,
  Hero,
  Enemy,
  SPRITE_TYPE
}
